<%@ page language="java" pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page isELIgnored="false" %> 

<%@ page import="net.ssta.core.db.RecordSet"%>
<%@ page import="net.ssta.core.db.Record"%>
<%@ page import="net.ssta.core.web.RequestKit"%>
<%@ page import="net.ssta.core.db.PagingInfo"%>

<%
	String path = request.getContextPath();
	
	//分页参数
    PagingInfo pagingInfo =(PagingInfo) request.getAttribute("pagingInfo");
    int pageno = pagingInfo.getCurrentPageNo();
	//获取技术需求列表
	RecordSet messageSet = (RecordSet)request.getAttribute("messageSet");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
<HEAD>
    <TITLE>用户留言</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=utf-8">
    <META http-equiv=x-ua-compatible content=ie=7>
    <META content="MSHTML 6.00.6000.17107" name=GENERATOR>
    <link type="text/css" rel="stylesheet" href="<%=path%>/includes/css/commonStyle.css"/> 
    <link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/styleBase.css"/>
    <link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/ostable.css" />
    <link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/tab.css" />
    
    <link rel="stylesheet" href="<%=path%>/includes/lhgdialog/lhgdialog.css" />

	<script type='text/javascript' src="<%=path%>/includes/js/jquery.js"></script>
    <script type="text/javascript" src="<%=path%>/includes/styleBase/js/style.js"></script>
    
    <script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgcore.min.js"></script>
    <script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgdialog.js"></script>
    <SCRIPT>
	function _delete(){
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	if(confirm("您确定要删除所选中的信息？信息一旦删除将不能恢复！")){
		for(var i=0; i<ids.length; i++)
		{
			if(ids[i].checked) 
			{
				pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
			}
		}
		
		 $.ajax({
				type: "POST", url: "<%=path%>/membercenter/message?method=messageDelete&uuids="+pids,
				error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
				success: function(msg){
					alert("删除操作成功!");
					_goPage(<%=pageno%>);
				}
			 });
		}
	}


	function _infoshow(uuid)
		 {
	  		var dlg = new J.ui.dialog({ id:'handledemand',
	  		                         title:'查看用户留言',
	  		                         range:true,
	  		                         btns:true,
	  		                         page:'<%=path%>/back/message?method=messageShow&uuid='+uuid,
	  		                         width:800,
	  		                         height:600,
	  		                         windowObj:window});
	  		dlg.ShowDialog();
		 } 
		 /* 
    function _infoshow(uuid)
	{
	 	window.location.href = "<%=path%>/membercenter/message?method=messageShow&uuid="+uuid;
	}  
	*/
    </SCRIPT>    
</HEAD>

<BODY>
<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left" width="2">&nbsp;</td>
      <td class="box_top_center">用户留言列表</td>
      <td class="box_top_right" width="2">&nbsp;</td>
    </tr>
  </table>
</div>

<div class="contentBox">
    <table class="osTable" cellpadding="0" cellspacing="0" border="0">
      <thead>
        <tr >
        	<th width="40" height="30"><input type="checkbox" name="selall" id="selall" value=""></th>
            <th width="500">标题</th>
            <th width="100">发布时间</th>
            <th width="100">处理状态</th>
            <th width="80">操作</th>
        </tr>
      </thead>
      <tbody>
      <%
		if(messageSet!=null){
			for(int i=0;i<messageSet.size();i++){
      			Record messageRecord = messageSet.get(i);
				String content = messageRecord.getString("CONTENT","");
				if(content!=null && content.length()>40){
					content = content.substring(0,40);
				}
				
				String ifreply = messageRecord.getString("IFREPLY","0");
				String strreply = "未回复";
				String colorstyle = "red";
				if("1".equals(ifreply)){
					strreply = "已回复";
					colorstyle="black";
				}
		%>
        <tr>
        	<td width="40" height="30"><input type="checkbox" name="uuid" id="uuid" value="<%=messageRecord.getString("ID","")%>"></td>
            <td width="500" style="color:<%=colorstyle%>;"><%=content%></td>
            <td width="100" style="color:<%=colorstyle%>;"><%=messageRecord.getString("SUBMITDATE","")%></td>
            <td width="100" style="color:<%=colorstyle%>;">
            <%if("1".equals(ifreply)){%>
				已回复
			<%}else{%>
            	未回复
            <%}%>
            </td>
            <td width="80">
            	<a href="#2012" onClick="_infoshow('<%=messageRecord.getString("ID","")%>')">回复</a>
            </td>
            
        </tr>
        <%
			}
		}
		%>
       </tbody>
   </table>
   <div class="navDiv">
        <div class="navLeftDiv">
        <a href="#2010" class="imgButton" onClick="javascript:_delete();"><span>删除选中的用户留言</span></a>
        </div>
        <div  class="navRightDiv">
            <jsp:include flush="true" page="/common/paging.jsp"></jsp:include>
        </div>
	</div>
</div>
        

</BODY>
</HTML>
